package org.jdu.dao.metadata;

import java.io.Serializable;
import java.util.Comparator;

public class ColumnMetadata implements Serializable{

	
	/**
	 * 
	 */
	private static final long serialVersionUID = -6424699349630368633L;


	public static final Comparator COMPARATOR = new ColumnMetadata.ColumnMetadataComparator();

	
	private String tableCatalog;
	private String tableSchema;
	private String tableName;
	private String columnName;
	private String dataType;
	private String typeName;
	private String columnSize;
	private String decimalDigits;
	private String numPrecRadix;
	private String nullable;
	private String remarks;
	private String columnDef;
	private String sqlDataType;
	private String sqlDatetimeSub;
	private String charOctetLength;
	private String ordinalPosition;
	private String isNullable;
	private String scopeCatalog;
	private String scopeSchema;
	private String scopeTable;
	private String sourceDataType;
	public String getTableCatalog() {
		return tableCatalog;
	}
	public void setTableCatalog(String tableCatalog) {
		this.tableCatalog = tableCatalog;
	}
	public String getTableSchema() {
		return tableSchema;
	}
	public void setTableSchema(String tableSchema) {
		this.tableSchema = tableSchema;
	}
	public String getTableName() {
		return tableName;
	}
	public void setTableName(String tableName) {
		this.tableName = tableName;
	}
	public String getColumnName() {
		return columnName;
	}
	public void setColumnName(String columnName) {
		this.columnName = columnName;
	}
	public String getDataType() {
		return dataType;
	}
	public void setDataType(String dataType) {
		this.dataType = dataType;
	}
	public String getTypeName() {
		return typeName;
	}
	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}
	public String getColumnSize() {
		return columnSize;
	}
	public void setColumnSize(String columnSize) {
		this.columnSize = columnSize;
	}
	public String getDecimalDigits() {
		return decimalDigits;
	}
	public void setDecimalDigits(String decimalDigits) {
		this.decimalDigits = decimalDigits;
	}
	public String getNumPrecRadix() {
		return numPrecRadix;
	}
	public void setNumPrecRadix(String numPrecRadix) {
		this.numPrecRadix = numPrecRadix;
	}
	public String getNullable() {
		return nullable;
	}
	public void setNullable(String nullable) {
		this.nullable = nullable;
	}
	public String getRemarks() {
		return remarks;
	}
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	public String getColumnDef() {
		return columnDef;
	}
	public void setColumnDef(String columnDef) {
		this.columnDef = columnDef;
	}
	public String getSqlDataType() {
		return sqlDataType;
	}
	public void setSqlDataType(String sqlDataType) {
		this.sqlDataType = sqlDataType;
	}
	public String getSqlDatetimeSub() {
		return sqlDatetimeSub;
	}
	public void setSqlDatetimeSub(String sqlDatetimeSub) {
		this.sqlDatetimeSub = sqlDatetimeSub;
	}
	public String getCharOctetLength() {
		return charOctetLength;
	}
	public void setCharOctetLength(String charOctetLength) {
		this.charOctetLength = charOctetLength;
	}
	public String getOrdinalPosition() {
		return ordinalPosition;
	}
	public void setOrdinalPosition(String ordinalPosition) {
		this.ordinalPosition = ordinalPosition;
	}
	public String getIsNullable() {
		return isNullable;
	}
	public void setIsNullable(String isNullable) {
		this.isNullable = isNullable;
	}
	public String getScopeCatalog() {
		return scopeCatalog;
	}
	public void setScopeCatalog(String scopeCatalog) {
		this.scopeCatalog = scopeCatalog;
	}
	public String getScopeSchema() {
		return scopeSchema;
	}
	public void setScopeSchema(String scopeSchema) {
		this.scopeSchema = scopeSchema;
	}
	public String getScopeTable() {
		return scopeTable;
	}
	public void setScopeTable(String scopeTable) {
		this.scopeTable = scopeTable;
	}
	public String getSourceDataType() {
		return sourceDataType;
	}
	public void setSourceDataType(String sourceDataType) {
		this.sourceDataType = sourceDataType;
	}
	
	private static class ColumnMetadataComparator implements Comparator {

		public int compare(Object col1, Object col2) {
			if((col1 instanceof ColumnMetadata ) && (col1 instanceof ColumnMetadata)){
				ColumnMetadata c1 = (ColumnMetadata) col1;
				ColumnMetadata c2 = (ColumnMetadata) col2;
				return Integer.parseInt(c1.getOrdinalPosition())-Integer.parseInt(c2.getOrdinalPosition());
			}
			return 0;
		}

	}
}
